-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Components: Fix React Compiler error for 'useScrollRectIntoView' #66498
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@Mamaduka unit tests are failing because We could either look into adding global mocks for the whole Gutengerg project, or potentially add extra checks (or optional chaining) in the source code and add a comment explaining the reason for it. |
IMHO, those mutations should be allowed by the React Compiler, since all those |
That would be ideal, but the same issue remains with the refs (#29196). I've got a feeling it's a complex problem to resolve, and using |
4ceb079
to
925b5f5
Compare
Updated in 925b5f5. |
Flaky tests detected in 925b5f5. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11624389497
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @Mamaduka.
Just a minor optional suggestion
} else if ( rightOverflow > 0 ) { | ||
parent.scrollLeft = parentScroll + rightOverflow; | ||
parent.scroll?.( { left: parentScroll + rightOverflow } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likely the comment might make sense to be here too.
I wonder if we can isolate the logic to a single parent?.scroll()
call. Then, it will be just a single comment.
scrollLeft = parentScroll + rightOverflow; | ||
} | ||
|
||
if ( scrollLeft !== null ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a precaution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Mamaduka!
…dPress#66498) * Components: Fix React Compiler error for 'useScrollRectIntoView' * Use optional chaining and add inline comment * Use single scroll call Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org>
What?
Part of #61788.
Similar to #66492.
PR fixes React Compiler errors for the
useScrollRectIntoView
hook usingElement.scroll
instead of the shorthand method.Testing Instructions
Smoke test Tabs components in Storybook and editors.